package com.beamfield.dao.material;

import com.beamfield.model.PurchaseDetail;
import com.beamfield.modelVo.PurchaseDetailVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface PurchaseDetailMapper {
    int deleteByPrimaryKey(Long purchase_detail_id);

    int insert(PurchaseDetail record);

    int insertSelective(PurchaseDetail record);

    PurchaseDetail selectByPrimaryKey(Long purchase_detail_id);

    int updateByPrimaryKeySelective(PurchaseDetail record);

    int updateByPrimaryKey(PurchaseDetail record);

    List<PurchaseDetailVo> selectDetailsByPurchaseId(@Param("purchaseId") String purchaseId,
                                                     @Param("suppliesName") String suppliesName,
                                                     @Param("projectId") String projectId,
                                                     @Param("offset") String offset,
                                                     @Param("limit") String limit,
                                                     @Param("detailsState") String detailsState);

    long countDetailsByPurchaseId(@Param("purchaseId") String purchaseId,
                                  @Param("suppliesName") String suppliesName,
                                  @Param("detailsState")  String detailsState);

    int insertList(List<PurchaseDetail> purchaseDetailList);
    
    /**
     * 
     * @date 2018年6月13日
     * @author mintonzhang@163.com
     * @param suppliesid
     * @param beamid
     * @return
     */
    List<PurchaseDetail> selectBySuppliesId(@Param("suppliesId") String suppliesid,@Param("planId") Long planid,@Param("beamId") Long beamid);


    double getSumnumByProjectIdAndSupId(@Param("projectId") long projectId,@Param("suppliesId") String suppliesId);

    double getAlreadyPurchaseNum(@Param("month") String month, @Param("suppliesId") String suppliesId);

    List<PurchaseDetailVo> selectByMonth(@Param("month") String month,@Param("beamId") long beamId);

    double getDemandByProjectIdAndSupId(@Param("month") String month,@Param("suppliesId") String suppliesId);

    double getPurchaseNum(@Param("suppliesId")String suppliesId,@Param("beamId")Long beamId);
}